<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>


<% 
  
    // 接收用户数据
    request.setCharacterEncoding("utf-8");
    String userid = request.getParameter("userid");
    String name = request.getParameter("name");
    String pwd = request.getParameter("pwd");
    String phone = request.getParameter("phone");
    String email = request.getParameter("email");
    String address = request.getParameter("address");
    String btn = request.getParameter("btn");
    String sql = "";
    //insert
    sql = "insert into customer(userid,name,pwd,phone,email,address) values('"+ userid +"','"+ name +"','"+ pwd +"','"+ phone +"','"+ email +"','"+ address +"')";
    
    if("修改".equals(btn)){
       //update
        sql = "update customer set name='" + name +"',pwd='" + pwd +"',phone='" + phone +"',email='" + email +"',address='" + address +"' where userid='"+ userid +"'";
    }else if("del".equals(btn)){
    	
    	//delete
        sql = "delete from customer where userid='"+ userid + "'";
    }
    	
     
    int ret = aa.db.DBTools.doSql(sql);
    System.out.println("ret=" + ret);
    //返回到页面
    response.sendRedirect("userlist.jsp");
    
    

  %>

</body>
</html>